package com.insigma.business.qrcode.intell.service.impl;

import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.intell.dto.CareSoldierDemandBSearcher;
import com.insigma.business.qrcode.intell.entity.CareSoldierDemandDO;
import com.insigma.business.qrcode.intell.dao.CareSoldierDemandDao;
import com.insigma.business.qrcode.intell.service.CareSoldierDemandService;
import com.insigma.business.qrcode.soldier.dto.SequenceNameConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("careSoldierDemandService")
public class CareSoldierDemandServiceImpl implements CareSoldierDemandService {

    @Autowired(required = false)
    private CareSoldierDemandDao careSoldierDemandDao;
    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    @Override
    public List<CareSoldierDemandDO> search(CareSoldierDemandBSearcher innerSearcher) {
        return careSoldierDemandDao.search(innerSearcher);
    }

    @Override
    public CareSoldierDemandDO get(String id) {
        return careSoldierDemandDao.get(id);
    }

    @Override
    public Integer insert(CareSoldierDemandDO careSoldierDemandDO) {
        careSoldierDemandDO.setId(sequenceGenerator.genKey(SequenceNameConstant.CARE_SOLDIER_DEMAND_ID));
        return careSoldierDemandDao.insert(careSoldierDemandDO);
    }

    @Override
    public Integer update(final CareSoldierDemandDO careSoldierDemandDO){
        return careSoldierDemandDao.update(careSoldierDemandDO);
    }
}
